/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.core.preference;

import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.jface.resource.ColorRegistry;
import org.eclipse.swt.graphics.RGB;

/**
 * Constant definitions for Papyrus main preferences.
 * 
 * @author Gilles Cannenterre
 * @since 23 oct. 06
 */
public class PreferenceConstants {
	
	/**
	 * The Constant papyrusColorYellow.
	 */
	private static final String papyrusColorYellow = "PAPYRUS_YELLLOW";
	
	/**
	 * The Constant papyrusColorBrown.
	 */
	private static final String papyrusColorBrown = "PAPYRUS_BROWN";
	
	/**
	 * The Constant papyrusColorBlack.
	 */
	private static final String papyrusColorBlack = "PAPYRUS_BLACK";
	
	/**
	 * The Constant papyrusColorblue.
	 */
	private static final String papyrusColorBlue = "PAPYRUS_BLUE";
	
	/**
	 * The Constant papyrusColorDarkBlue.
	 */
	private static final String papyrusColorDarkBlue = "PAPYRUS_DARKBLUE";
	
	/**
	 * The Constant papyrusColorGray.
	 */
	private static final String papyrusColorGray = "PAPYRUS_GRAY";
	
	/**
	 * The Constant papyrusColorWhite.
	 */
	private static String papyrusColorWhite = "PAPYRUS_WHITE";;
	
	/** ID for the conlor of intherited Element*/
	public static String P_INHERITED_ELEMENT_COLOR = "com.cea.papyrus.inheritedElementColor";


	/**
	 * The Color Registry.
	 */
	private static ColorRegistry colorRegistry = new ColorRegistry();
	
	/**
	 * Static constructor
	 */
	static {
	    loadColorRegistry();
	}

	public static void loadColorRegistry() {
		// Put default value in color regisry
		colorRegistry.put(papyrusColorYellow, new RGB(248,249,214));
		colorRegistry.put(papyrusColorBrown, new RGB(157,124,47));
		colorRegistry.put(papyrusColorBlack, new RGB(0,0,0));
		colorRegistry.put(papyrusColorBlue,  new RGB(206,210,253));
		colorRegistry.put(papyrusColorDarkBlue, new RGB(227,221,239));
		colorRegistry.put(papyrusColorGray, new RGB(166,157,183));
		colorRegistry.put(papyrusColorWhite, new RGB(255,255,255));
		
	}

	/**
	 * @return the papyrusColorBlack
	 */
	public static RGB getPapyrusColorBlack() {
		return colorRegistry.getRGB(papyrusColorBlack);
	}

	/**
	 * @return the papyrusColorBlue
	 */
	public static RGB getPapyrusColorBlue() {
		return colorRegistry.getRGB(papyrusColorBlue);
	}

	/**
	 * @return the papyrusColorBrown
	 */
	public static RGB getPapyrusColorBrown() {
		return colorRegistry.getRGB(papyrusColorBrown);
	}

	/**
	 * @return the papyrusColorDarkBlue
	 */
	public static RGB getPapyrusColorDarkBlue() {
		return colorRegistry.getRGB(papyrusColorDarkBlue);
	}

	/**
	 * @return the papyrusColorGray
	 */
	public static RGB getPapyrusColorGray() {
		return colorRegistry.getRGB(papyrusColorGray);
	}

	/**
	 * @return the papyrusColorYellow
	 */
	public static RGB getPapyrusColorYellow() {
		return colorRegistry.getRGB(papyrusColorYellow);
	}

	/**
	 * @return the papyrusColorWhite
	 */
	public static RGB getPapyrusColorWhite() {
		return colorRegistry.getRGB(papyrusColorWhite);
	}
	
	public static void setDefaultPreferences(IPreferenceStore store) {
		PreferenceConverter.setDefault(store, P_INHERITED_ELEMENT_COLOR, PreferenceConstants.getPapyrusColorGray());
	}
	
}